#导包
import time
from appium import webdriver
from selenium.webdriver.common.by import By

#准备测试数据：appium url
url = "http://127.0.0.1:4723/wd/hub"

#准备测试数据
d = {
    "platformName":"Android", #平台名
    "deviceName":"BAL-AL80", #设备名
    "appPackage":"com.android.settings", #包名
    "appActivity":".Settings"
}

#连接手机,创建驱动
driver = webdriver.Remote(url, d)
time.sleep(3)

#滑动操作(200,600)--->(200.200)
driver.swipe(200, 600, 200,200, 2000)
time.sleep(3)
#点击“内存”
driver.find_element(By.XPATH, "//*[@text='内存']").click()
time.sleep(3)
#点击时间下拉框
driver.find_element(By.ID, "com.android.settings:id/filter_spinner").click()
time.sleep(3)
#点击“12小时”
driver.find_element(By.XPATH, "//*[@text='12小时']").click()
time.sleep(10)

#关闭驱动
driver.quit()


